package com.gofaraway.common.exception;

import static com.gofaraway.common.exception.ErrorCodeEnum.*;

/**
 * 业务异常
 * 业务异常可以当返参使用
 *
 * @author: 1065277
 * @since: 2022-08-02
 **/
public class BusinessException extends BaseException {
    /**
     * 业务异常前缀
     */
    public static String BUSINESS_ERROR_CODE_PREFIX = "A";

    public BusinessException(ErrorCodeEnum errorCodeEnum) {
        super(errorCodeEnum);
    }

    public BusinessException(ErrorCodeEnum errorCodeEnum, Object data) {
        super(errorCodeEnum, data);
    }

    /**
     * 通用系统异常,系统类异常统一返回前端
     * 使用之前需要在响应的业务类中注册
     */
    public static final BusinessException EXCEPTION_ERROR_CODE_A0001 = new BusinessException(ERROR_CODE_A0001);
    public static final BusinessException EXCEPTION_ERROR_CODE_A0002 = new BusinessException(ERROR_CODE_A0002);
    public static final BusinessException EXCEPTION_ERROR_CODE_A0003 = new BusinessException(ERROR_CODE_A0003);
    public static final BusinessException EXCEPTION_ERROR_CODE_A0101 = new BusinessException(ERROR_CODE_A0101);
    public static final BusinessException EXCEPTION_ERROR_CODE_A0102 = new BusinessException(ERROR_CODE_A0102);
    public static final BusinessException EXCEPTION_ERROR_CODE_A0103 = new BusinessException(ERROR_CODE_A0103);
    public static final BusinessException EXCEPTION_ERROR_CODE_A0112 = new BusinessException(ERROR_CODE_A0112);


}
